import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:${USER}
 * Date:${YEAR}-${MONTH}-${DAY}
 * ${TIME}
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[1005];
        int k=0;
        for(int i=1;i<=n;i++){
            String s=i+"";
            if(i%12==0){
                arr[k++]=i;
            }
            else if(s.contains("12")){
                arr[k++]=i;
            }
        }
        for(int i=0;i<k;i++){
            if(i==k-1){
                System.out.print(arr[i]);
            }else{
                System.out.print(arr[i]+" ");
            }
        }
    }
}